<template>
    <div>
      <table>
        <tr>
          <td>
            标题
          </td>
          <td>
            内容
          </td>
          <td>
            操作
          </td>

        </tr>
        <tr v-for="item in news">
          <td>
            {{ item.id }}
          </td>
          <td>
            {{ item.content }}
          </td>
          <td>
            <router-link :to="{path:'/pinglun',query:{ids:item.id}}">评论</router-link>
          </td>

        </tr>
      </table>
    </div>
</template>

<script>
  import axios from 'axios'
    export default {
        name: "show",
        data(){
          return{
            news:[]
          }
        },
        mounted() {

          axios({
            url:'http://127.0.0.1:8000/shownew/',
            method:'get',

          }).then(res=>{
            this.news = res.data.news
          })
        },
        methods:{
          on_submit(id){
            this.$router.push('/pinglun')
          }
        }
    }
</script>

<style scoped>

</style>
